1、 登录mysql报错: 1 2 3 mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/data/mysql/tmp/mysql.sock' (2)
2、netstat -tunlp|grep 3306发现mysql进程不存在,尝试去启动mysql: 1 2 3 4 /etc/init.d/mysql restart ERROR! MySQL server PID file could not be found! Starting MySQL....................................................................................^C 启动失败,按ctrl+c退出。
3、查看log日志,一直在刷错误日志 1 2 [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11 [Note] InnoDB: Check that you do not already have
4、查看磁盘使用情况 1 2 3 4 df -h Filesystem Size Used Avail Use% Mounted on /dev/sdc1 1.1T 59G 967G 6% /data 数据目录还有很多空间。
5、查看mysql进程 1 2 3 4 5 shell>ps -ef|grep mysql mysql 1486 130771 2 05:16 pts/0 00:00:01 /data/mysql/bin/mysqld --basedir=/data/mysql --datadir=/data/mysql/data --plugin-dir=/data/mysql/lib/plugin --user=mysql --log-error=/data/mysql/log/error.log --open-files-limit=65535 --pid-file=/data/mysql/tmp/mysql.pid --socket=/data/mysql/tmp/mysql.sock --port=3306 root 77736 1 0 Jul25 ? 00:00:00 /bin/sh /data/mysql/bin/mysqld_safe --datadir=/data/mysql/data --pid-file=/data/mysql/tmp/mysql.pid mysql 128601 77736 85 05:13 ? 00:03:49 /data/mysql/bin/mysqld --basedir=/data/mysql --datadir=/data/mysql/data --plugin-dir=/data/mysql/lib/plugin --user=mysql --log-error=/data/mysql/log/error.log --open-files-limit=65535 --pid-file=/data/mysql/tmp/mysql.pid --socket=/data/mysql/tmp/mysql.sock --port=3306 root 130771 1 0 05:16 pts/0 00:00:00 /bin/sh /data/mysql/bin/mysqld_safe --datadir=/data/mysql/data --pid-file=/data/mysql/tmp/mysql.pid
6、top查看进程运行情况 1 2 3 4 5 6 7 Tasks: 187 total, 1 running, 186 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.4 us, 0.3 sy, 0.0 ni, 99.2 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 32930580 total, 21548588 free, 7218592 used, 4163400 buff/cache KiB Swap: 0 total, 0 free, 0 used. 24748960 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 128601 mysql 20 0 21.711g 4.678g 12784 S 2.6 14.9 3:50.26 mysqld
7、杀掉进程128601 1 2 kill -9 128601 /data/mysql/bin/mysqld_safe: line 198: 1486 Killed nohup /data/mysql/bin/mysqld --basedir=/data/mysql --datadir=/data/mysql/data --plugin-dir=/data/mysql/lib/plugin --user=mysql --log-error=/data/mysql/log/error.log --open-files-limit=65535 --pid-file=/data/mysql/tmp/mysql.pid --socket=/data/mysql/tmp/mysql.sock --port=3306 < /dev/null > /dev/null 2>&1
因为mysql的守护进程存在,会自动启动mysql进程,再次登录数据库 mysql -uroot -p,登录正常。